﻿using System;
using SalesSys.Comm.DAL;

namespace SalesSys.DAL
{
    /// <summary>
    /// sql配置列表，注意其中配置所赋值为默认值，不一定是最终值
    /// </summary>
    public partial  class SqlTextList : SqlTextCfg
    {
        //命名办法：包_名称
        public readonly SqlText WX_UserCount = "select Count(*) from Employee where IsLeave=@IsLeave";
        public readonly SqlText DeportHistory = " select * from (select *,ROW_NUMBER() over(partition by DepotId,CommodityId order by UpdateTime desc) as new_index from [sal_DepotCommodity_history] where @time>UpdateTime) a where a.new_index=1 and a.DepotId=@depotId";


    }

    public partial class SqlTextList : SqlTextCfg
    {
        #region cfg
        static SqlTextList instance;


        /// <summary>
        /// 等效于GetSqlList()
        /// </summary>
        public static SqlTextList SqlList { get { return GetSqlList(); } }
        /// <summary>
        /// 获取sql语句配置信息，
        /// </summary>
        /// <param name="cfgName"></param>
        /// <returns></returns>
        public static SqlTextList GetSqlList(string cfgName = null)
        {
            if (!string.IsNullOrWhiteSpace(cfgName))
            {
                throw new NotImplementedException("配置文件获取暂未实现");
            }
            return instance ?? (instance = new SqlTextList());
        }
        SqlTextList()
        {
            //可以在此做实际配置修改，创建非默认的sqlText，自动读取xml文件反射赋值暂未实现
            //UserSelect = new SqlText(UserSelect.SqlStr + " where 1=1");

        }
        #endregion
    }
}
